#include "Clean.h"

VOID DriverUnload(IN PDRIVER_OBJECT lpDriverObject)
{
    UNREFERENCED_PARAMETER(lpDriverObject);

    FreeControlDeviceObject();

    if (ProtectGlobals.hObProcess)
        Ob2UnRegisterCallbacks(ProtectGlobals.hObProcess);

    if (ProtectGlobals.hObThread)
        Ob2UnRegisterCallbacks(ProtectGlobals.hObThread);
}

void FreeControlDeviceObject()
{
    UNICODE_STRING usWin32Name = { 0 };

    if (g_lpDeviceObject)
        IoDeleteDevice(g_lpDeviceObject);

    RtlInitUnicodeString(&usWin32Name, USTRING_SYMBOL_NAME);
    IoDeleteSymbolicLink(&usWin32Name);
}